home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10060 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  47 lines

  1. Path: wizard.qualcomm.com!fmerrow
  2. From: fmerrow@wizard.qualcomm.com (Frank Merrow)
  3. Newsgroups: comp.lang.c++
  4. Subject: I presume this is a SIMPLE iostream question
  5. Date: 5 Mar 1996 23:23:23 GMT
  6. Organization: Qualcomm Inc.
  7. Distribution: na
  8. Message-ID: <4hiidb$qbj@qualcomm.com>
  9. NNTP-Posting-Host: wizard.qualcomm.com
  10.  
  11.  
  12. Hi,
  13.  
  14. Using EMX under OS/2 I lifted the following program out of Stroustrup
  15. with only minor changes:
  16.  
  17. #include <iostream.h>
  18. main()
  19. {
  20.   char chr;
  21.   while(cin.get(chr))
  22.     {
  23.     cout << chr;
  24.     }
  25. }
  26.  
  27. It runs, but there are a number of problems:
  28.  
  29. 1. The size of the output file does not match the size of the input file.
  30. In "C" I would add a binary flag, but nothing I can find in iostream.h
  31. seems to be the equivalent.
  32.  
  33. 2. It is SLOOOOOOOWWWWWW.  Not just slow, VERY SLOW!
  34.  
  35.    a. I assume that perhaps stdin/stdout are tied().  How do I break this
  36.    "standard" connection if in fact it exists.
  37.  
  38.    b. I would prefer some kind of a "block read".  What routines should I
  39.    look at.  Note that I have NO IDEA what the input looks like.  It might
  40.    be "text", but also might be binary "junk" and so the routines should
  41.    be able to handle both without loosing stuff etc.
  42.  
  43. Pointers to Web Pages with this information and/or sources that I could
  44. have used to solve this on my own greatly appreciated.
  45.  
  46. Frank
  47.